package com.jp.study.config;

import org.springframework.context.annotation.Bean;  
import org.springframework.context.annotation.Configuration;  
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;  
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.jp.study.Interceptor.LoggerInterceptor;  
  
/**
 * 
* @author dinghao
* @ClassName: InterceptorRegister 
* @Description: 记录Controller层的进入和离开的时间,并计算其过程的时间(@LoggerAnnotation 只在Controller层中的方法有效)
* @date 2018年3月21日 上午9:59:55 
*
 */

@Configuration  
public class InterceptorRegister extends WebMvcConfigurerAdapter {  
  
  
  
    @Bean  
    public LoggerInterceptor loggerInterceptor(){  
        return new LoggerInterceptor();  
    }  
  
    @Override  
    public void addInterceptors(InterceptorRegistry registry){  
        registry.addInterceptor(loggerInterceptor());  
    }  
  
}  
